package at.fhooe.stefanirndorfer.graphics;



import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;


public class Graphics_Utils {

	static void initializeOpenGL(int w, int h){

//		glMatrixMode(GL_PROJECTION);
//		glLoadIdentity();
//		//glOrtho(0, w, h, 0, 1, -1);
//		/** center coordinates origin */
//		glOrtho(-w/2, w/2, -h/2, h/2, 1, -1);
//		glMatrixMode(GL_MODELVIEW);
//		glEnable(GL_TEXTURE_2D);
		
		try {
			Display.setDisplayMode(new DisplayMode(w,h));
			Display.setInitialBackground(1.0f, 1.0f, 1.0f);
			Display.create();
			Display.setVSyncEnabled(true);
		} catch (LWJGLException e) {
			e.printStackTrace();
			System.exit(0);
		}
 
		GL11.glEnable(GL11.GL_TEXTURE_2D);
		GL11.glShadeModel(GL11.GL_SMOOTH);        
		GL11.glDisable(GL11.GL_DEPTH_TEST);
		GL11.glDisable(GL11.GL_LIGHTING);                    
 
		GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);                
        GL11.glClearDepth(1);                                      
 
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
 
        GL11.glViewport(0,0,w,h);
		GL11.glMatrixMode(GL11.GL_MODELVIEW);
 
		GL11.glMatrixMode(GL11.GL_PROJECTION);
		GL11.glLoadIdentity();
		GL11.glOrtho(-w/2, w/2, h/2, -h/2, 1, -1);
		GL11.glMatrixMode(GL11.GL_MODELVIEW);
		
	}
	
}
